Skip to content

Fix Line failing with buff and path_arc #4193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

irvanalhaq9
Copy link
Contributor

@irvanalhaq9 irvanalhaq9 commented Mar 17, 2025

Overview: What does this pull request change?

Fixes issue: #4132

Motivation and Explanation: Why and how do your changes improve the library?

Issue Explanation

When buff is given, Line internally calls pointwise_become_partial, passing self as the argument for vmobject:

self.pointwise_become_partial(vmobject=self, a=buff_proportion, b=1 - buff_proportion)

In Manim v0.19.0, the pointwise_become_partial code was modified in commit 374eeeba (from PR #3760). This change introduced the issue.

Initially (in my first commit), I addressed this issue by modifying pointwise_become_partial so that it creates a copy of vmobject.points if vmobject is self, avoiding in-place modification of vmobject.points when self.points is set to np.empty(...). Making a copy is essential because self.points and vmobject.points are used together after self.points is set to np.empty(...). See the related source code.

However, I realized that a simpler solution exists which avoids modifying pointwise_become_partial. Instead, the issue can be resolved by adjusting how Line uses it: When calling it, instead of passing vmobject=self, we should pass vmobject=self.copy(). I’ve implemented this in my most recent commit.

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

@github-project-automation github-project-automation bot moved this to 🆕 New in Dev Board Mar 17, 2025
@irvanalhaq9 irvanalhaq9 changed the title Fix Line failing with buff and path_arc (issue #4132) Fix Line failing with buff and path_arc Mar 30, 2025
@irvanalhaq9 irvanalhaq9 force-pushed the fix-line-buff-patharc branch from 29759b5 to efb532d Compare April 20, 2025 20:02
@irvanalhaq9 irvanalhaq9 force-pushed the fix-line-buff-patharc branch from efb532d to 27741fe Compare April 20, 2025 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

1 participant